import {baseUrl, getUploadConfig} from "@/config/env";
import startSearchModel from "@/config/startSearchModel";

const uploadConfig = getUploadConfig()
export default () => {
    return {
        submitText: '修改',
        size: 'default',
        labelWidth: 120,
        index: true,
        page: true,
        align: "center",
        menuType: 'menu',
        menuAlign: 'center',
        menuPosition: "right",
        searchBtn: true,
        searchShow: false,
        searchIndex: 2,
        searchMenuSpan: 6,
        searchIcon: true,
        permissionBtn: {
            addBtn: 'sys:user:add',
            editBtn: 'sys:user:edit',
            viewBtn: 'sys:user:info',
            delBtn: 'sys:user:delete',
            //下载数据模板按钮
            downloadTemplateBtn: 'sys:user:downloadTemplate',
            //数据导出按钮
            exportExcelBtn: 'sys:user:exportExcel',
            //数据导入按钮
            importExcelBtn: 'sys:user:importExcel',

        },
        column: [
            {
                label: '头像',
                row: true,
                accept: "image/*",
                prop: 'avatar',
                type: "upload",
                limit: 1,
                span: 24,
                layoutCenter: true,
                listType: 'picture-card',
                action: uploadConfig.action,
                propsHttp: uploadConfig.propsHttp,
                tip: "头像，请上传上传png或者jpg",
                hide: true,
                rules: [{
                    required: false,
                    trigger: "blur"
                }]
            },
            {
                label: '账号',
                span: 12,
                prop: 'userName',
                editDisabled: true,
                editDetail: true,
                search: true,
                searchMode: startSearchModel.LIKE_RIGHT,
                rules: [{
                    required: true,
                    trigger: "blur"
                }]
            },
            {
                label: '密码',
                span: 12,
                prop: 'userPwd',
                editDisabled: true,
                editDisplay: false,
                viewDisplay: false,
                hide: true,
                rules: [{
                    required: true,
                    trigger: "blur"
                }]
            },
            {
                label: '昵称',
                span: 12,
                prop: 'nickName',
                rules: [{
                    required: true,
                    trigger: "blur"
                }]
            },
            {
                label: '姓名',
                span: 12,
                prop: 'realName',
                search: true,
                rules: [{
                    required: true,
                    trigger: "blur"
                }]
            },
            {
                label: '所属机构',
                span: 12,
                prop: 'deptId',
                type: "tree",
                search: true,
                dicUrl: baseUrl + "/start/sysDept/listTree",
                cascaderItem: ["deptJobId"],
                cascaderChange: true,
                props: {
                    label: "deptName",
                    value: "id",
                }
            },
            {
                label: '岗位',
                span: 12,
                prop: 'deptJobId',
                search: true,
                type: "select",
                dicUrl: baseUrl + "/start/sys/sysDeptJob/getList?deptId={{deptId}}",
                dicMethod: "get",
                props: {
                    label: 'jobName',
                    value: 'id',
                },
                rules: [{
                    required: false,
                    trigger: "blur"
                }]
            },
            {
                label: '邮箱',
                span: 12,
                prop: 'email',
                search: true,
                type: "input",

            }, {
                label: '电话',
                span: 12,
                prop: 'phone',
                search: true,

            }, {
                label: 'QQ',
                span: 12,
                prop: 'qq',
                search: true,
            },

            {
                label: '是否启用',
                span: 12,
                prop: 'isEnabled',
                type: "radio",
                search: true,
                value: 0,
                dicData: [{
                    label: '未启用',
                    value: 0
                }, {
                    label: '已启用',
                    value: 1
                }],
            },
            {
                label: '是否锁定',
                span: 12,
                prop: 'isLocked',
                type: "radio",
                search: true,
                value: 0,
                dicData: [{
                    label: '未锁定',
                    value: 0
                }, {
                    label: '已锁定',
                    value: 1
                }],
            },
            {
                label: '备注',
                span: 24,
                prop: 'remarks',
                type: "textarea",
                maxlength: 100,
                search: false,
                showColumn: false,
                showWordLimit: true,
            },
        ]
    }
}

